package com.example.threaddemo.ThreadClass3;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class ThreadClassDemo03 {

    public static void main(String[] args) throws ExecutionException, InterruptedException {


        MyCallable myCallable =new MyCallable();

        FutureTask<Integer> futureTask =new FutureTask<>(myCallable);

        Thread t1 =new Thread(futureTask);
        t1.start();
        Integer i = futureTask.get();
        System.out.println("i = " + i);


    }
}
